package org.agent.aigccore.basic.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * 通用配置类，用于定义全局共享的Bean
 * 解决循环依赖问题：将PasswordEncoder从SecurityConfig移至此处
 */
@Configuration
public class PasswordEncoderConfig {

    /**
     * 密码编码器Bean定义
     * 采用BCrypt算法进行密码加密
     *
     * @return PasswordEncoder实例
     */
    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}